//
//  PublishPaymentView.m
//  Hui
//
//  Created by HawkingWang on 16/10/31.
//  Copyright © 2016年 Hui. All rights reserved.
//

#import "PublishPaymentView.h"

@implementation PublishPaymentView
{
    NSString *num;
    UILabel *_warning;
}

//关闭View
- (IBAction)close:(id)sender {
    _paymentViewClick(0);
}
/**余额支付*/
- (IBAction)balance:(id)sender {
    num = @"0";
    _chooseBalance.image = [UIImage imageNamed:@"right-touch"];
    _chooseWechat.image = [UIImage imageNamed:@"right"];
    _chooseZFB.image = [UIImage imageNamed:@"right"];
    _chooseCard.image = [UIImage imageNamed:@"right"];
}
/**微信支付*/
- (IBAction)wechat:(id)sender {
    num = @"1";
    _chooseBalance.image = [UIImage imageNamed:@"right"];
    _chooseWechat.image = [UIImage imageNamed:@"right-touch"];
    _chooseZFB.image = [UIImage imageNamed:@"right"];
    _chooseCard.image = [UIImage imageNamed:@"right"];
}
/**支付宝支付*/
- (IBAction)zfb:(id)sender {
    num = @"2";
    _chooseBalance.image = [UIImage imageNamed:@"right"];
    _chooseWechat.image = [UIImage imageNamed:@"right"];
    _chooseZFB.image = [UIImage imageNamed:@"right-touch"];
    _chooseCard.image = [UIImage imageNamed:@"right"];
}
/**银行卡支付*/
- (IBAction)card:(id)sender {
    num = @"3";
    _chooseBalance.image = [UIImage imageNamed:@"right"];
    _chooseWechat.image = [UIImage imageNamed:@"right"];
    _chooseZFB.image = [UIImage imageNamed:@"right"];
    _chooseCard.image = [UIImage imageNamed:@"right-touch"];
}
/**确认充值*/
- (IBAction)pay:(id)sender {
    DLog(@"确认充值");
    if (!_warning) {
        _warning = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 50, SCREEN_HEIGHT / 2 - 50, 120, 40)];
        _warning.textAlignment = NSTextAlignmentCenter;
        _warning.text = @"请选择支付方式";
        _warning.textColor = [UIColor whiteColor];
        _warning.font = [UIFont fontWithName:APPFONT size:14];
        _warning.backgroundColor = RGBCOLOR(59, 68, 75);
        _warning.layer.masksToBounds = YES;
        _warning.layer.cornerRadius = 5;
        [self addSubview:_warning];
    }
    if (num.length == 0) {
        _warning.hidden = NO;
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            _warning.hidden = YES;
        });
    }else{
        [SVProgressHUD show];
        DLog(@"支付");
        _paymentViewClick(1);
    }
}


@end
